package com.fc.framework.core.interceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Component;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;

import com.fc.framework.core.FrameworkConstants;

@Component("baseInteceptor")
public class BaseInterceptor extends HandlerInterceptorAdapter {

    public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler,
                           ModelAndView modelAndView) throws Exception {
        request.setAttribute(FrameworkConstants.REQUEST_SESSION_ID, request.getSession().getId());
        request.setAttribute(FrameworkConstants.REQUEST_BASE_PATH, request.getContextPath());
        super.postHandle(request, response, handler, modelAndView);
    }
}